﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>登录</title>
    <link href="CSS/patient.css" rel="stylesheet" />
    <link href="CSS/public.css" rel="stylesheet" />
    <link href="CSS/reset.css" rel="stylesheet" />
    <script src="/Scripts/jquery-1.8.0.min.js"></script>
</head>
<body>
    <section id="container">

        <p class="page_caption">南京德朗诺</p>

        <section id="patient_edit">
            <form id="patient_edit_form" name="patient_edit_form" method="post">
                <section class="box">
                    <table class="table_data_edit">
                        <tbody>
                            <tr>
                                <th width="80">工号：</th>
                                <td>
                                    <input type="text" id="patientName" name="patients.realName" class="txt" value="" />
                                </td>
                                <td class="required">*</td>
                            </tr>
                            <tr>
                                <th>密码：</th>
                                <td>
                                    <input type="password" id="idNum" name="patients.idCard" class="txt" value="" />
                                </td>
                                <td class="required">*</td>
                            </tr>
                        </tbody>
                    </table>
                </section>
                <button type="submit" class="btn">登录</button>

            </form>
        </section>

    </section>
</body>
<script type="text/javascript">

    $(".btn").on("click", function () {
        var patientName = $("#patientName").val();
        var idNum = $("#idNum").val();
        $.ajax({
            type: "POST",
            url: "/Handler/TestHandler.ashx?action=SetPwd",
            data: { PatientName: patientName, IdNum: idNum },
            async: false,
            beforeSend: function () {
                var flag = true;
                var msg = '';
                if ($.trim($('#patientName').val()) == '') {
                    flag = false;
                    msg = '请填写工号';
                } else if ($.trim($('#idNum').val()) == '') {
                    flag = false;
                    msg = '请填写密码';
                }
                if (!flag) {
                    alert(msg);
                };
                return flag;
            },
            success: function (data) {
                data = eval("(" + data + ")");
                if (data.status == "1") {
                    document.forms[0].action = data.info;
                    document.forms[0].submit();
                } else {
                    alert(data.info);
                }
            }
        })
    });


</script>
</html>
